package com.example.serverlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/test01")
public class FreeMarker01 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //设置数据
        req.setAttribute("msg","hello FreeMarker");
        //请求转发
        req.getRequestDispatcher("template/test01.ftl").forward(req,resp);
        //resp.getWriter().write("123456");
    }
}
